package com.pth.action;

import com.opensymphony.xwork2.ActionSupport;
import com.pth.exception.MyException;
import com.pth.model.Policy;
import com.pth.service.PolicyService;

public class GetSiglePolicyAction extends ActionSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private int id;
	private Policy policy;
	private PolicyService policyService;
	
	
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}


	
	public Policy getPolicy() {
		return policy;
	}

	public void setPolicy(Policy policy) {
		this.policy = policy;
	}

	public PolicyService getPolicyService() {
		return policyService;
	}

	public void setPolicyService(PolicyService policyService) {
		this.policyService = policyService;
	}

	@Override
	public String execute() throws Exception {

		MyException myException=new MyException();
	
		policy=policyService.getPolicyByid(id);
		if(policy==null){
		
			throw(myException);
		}
		return SUCCESS;
	}
}
